<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        div{
            width: 200px;
            height: 200px;
            background-color: pink;
            /* transform: translateX(100px); */
            /* transform: translate(100px,100px); */
        }
        .father{
            position: relative;
            margin-top: 10px;
            width: 400px;
            height: 400px;
            background-color: pink;
        }
        .son{
            position: absolute;
            top: 50%;
            left: 50%;
            width: 200px;
            height: 200px;
            background-color: skyblue;
            /* transform: translate(-50%,-50%); 往上往左走高度的一半 */
            transform: translate(-50%,-50%);
        }
    </style>
</head>
<body>
    <div></div>
    <div class="father">
        <div class="son"></div>
    </div>
</body>
</html>